package org.nvframe.util;

import java.util.HashMap;
import java.util.Map;

public class Settings {
	
	private Map<String, String> settingMap = new HashMap<String, String> ();
	
	public boolean getBoolean(String key, boolean defaultVal) {
		if(!settingMap.containsKey(key))
			return defaultVal;
		return getBoolean(key);
	}
	
	public boolean getBoolean(String key) {
		return Boolean.parseBoolean(settingMap.get(key));
	}
	
	public String getString(String key, String defaultVal) {
		if(!settingMap.containsKey(key))
			return defaultVal;
		return getString(key);
	}
	
	public String getString(String key) {
		return settingMap.get(key);
	}
	
	public int getInt(String key, int defaultVal) {
		if(!settingMap.containsKey(key))
			return defaultVal;
		return getInt(key);
	}
	
	public int getInt(String key) {
		return Integer.parseInt(settingMap.get(key));
	}
	
	public float getFloat(String key, float defaultVal) {
		if(!settingMap.containsKey(key))
			return defaultVal;
		return getFloat(key);
	}
	
	public float getFloat(String key) {
		return Float.parseFloat(settingMap.get(key));
	}
	
	public void setSetting(String key, String value) {
		settingMap.put(key, value);
	}
	
	public boolean containsKey(String key) {
		return settingMap.containsKey(key);
	}

	public int getSize() {
		return settingMap.size();
	}
	
}
